package com.tanhua.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.domain.db.BlackList;
import com.tanhua.domain.db.UserInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author liuyp
 * @date 2021/01/27
 */
public interface BlackListMapper extends BaseMapper<BlackList> {
    /**
     * 分页查询某一用户的黑名单列表
     * @param page 分页信息
     * @param userId 用户id
     * @return userId对应的黑名单列表
     */
    @Select("SELECT ui.* FROM tb_black_list tl " +
            "LEFT JOIN tb_user_info ui ON tl.black_user_id = ui.id " +
            "WHERE tl.user_id = #{userId}")
    IPage<UserInfo> findBlackList(Page<UserInfo> page, @Param("userId") long userId);
}
